#ifndef __SUBJECT_GUI_H__
#define __SUBJECT_GUI_H__

//#include <afxwin.h>
#include "IUtility.h"
#include "IOptionsControl.h"

class CSubjectGui : public virtual ISubjectGui, public virtual IProductInstance
{
INIT_CLASS_PRODUCT(CSubjectGui)
public:
	const bool Init(const void * pvdPara, char * pszMsgTxt, int iMsgTxtSize);
	const void UnInit();
	void DrawContract(IContract * ptrContract, int iBorderWidth, bool bClearFlg, bool bFlg);
	void DrawValue(IContract * ptrContract, ITaskQueue * ptrQueue);
	void Select(IContract * ptrContract, void * ptrImage);
	bool GetRisk(IContract * ptrContract);
	void SetRisk(IContract * ptrContract, const bool bValue);
	const bool RefrshView(void * ptrImage, IStkItem * pszStkItem, bool bFlg);
	IContract * GetContract(int iLeft, int iTop, const char * pszSortType);
	int GetBorderX(IContract * ptrContract, const char * pszType);
	int GetBorderY(IContract * ptrContract, const char * pszType);
private:
	void InitBitmap();
	void InitRect(IContract * ptrContract, const char * pszType, ::RECT &clRect, int iLeft, int iTop, int iWidth, int iHeight);
	void DrawBorder(IContract * ptrContract, int iWidth);
	bool DrawCaption(IContract * ptrContract);
	void DrawTopHalfArea(IContract * ptrContract, bool bFlg);
	void DrawBottomHalf(IContract * ptrContract);
	int GetBorderWidth(IContract * ptrContract);
	string && GetValue(IContract * ptrContract, const char * pszName);
	bool Draw();
	COLORREF GetBackground(int iType);
	void DrawValues(IContract * ptrContract);
	void DrawGraphics(IContract * ptrContract, const char * pszName, ::HDC &refDc, const char * pszType, const char * pszValue, int iAtX, int iAtY, int iWidth, int iHeight);
	void SetStkItem(IStkItem * ptrStkItem);	
	
private:
	::RECT m_clViewRect;
	::HBITMAP m_ptrAscBitmap, m_ptrDesBitmap;
	::HDC m_clAscDC, m_clDesDC;
	IValueSet * m_ptrContractPos, * m_ptrPosList, * m_ptrPriceList;
	IStkItem * m_ptrStkItem;
	IContract * m_ptrSelectContract;
};



#endif // !__SUBJECT_GUI_H__
